package ooday04;
import java.util.Timer;
import java.util.TimerTask;
public class TimerDemo {
    public static void main(String[] args){
        //匿名内部类的练习----定时器
        Timer timers = new Timer();
        int interval = 1000;
        timers.schedule(new TimerTask() {
            public void run() {
                System.out.println("该练代码了");
            }
        },interval,interval);












         /*Timer timer = new Timer(); //定时计时器
         int interval = 1000; //定时间隔
         timer.schedule(new TimerTask() {
             public void run() {
                 System.out.println("该练代码啦!!!!");
             }
         }, interval,interval);  //定时计划表

          */
    }
}
